Skip to content

Conversation

@Gyuhyeok99
Copy link
Contributor

관련 이슈

작업 내용

PATCH 메서드에 따라 전송한 리소스만 변경되게 수정하였습니다.

특이 사항

지원자 조회 e2e 테스트가 실패했는데 이건 영서님이 ci pr에서 수정하신 거 같습니다.

리뷰 요구사항 (선택)

@Gyuhyeok99 Gyuhyeok99 added the 버그 Something isn't working label Apr 2, 2025
@Gyuhyeok99 Gyuhyeok99 requested review from nayonsoso and wibaek April 2, 2025 04:43
@Gyuhyeok99 Gyuhyeok99 self-assigned this Apr 2, 2025
@coderabbitai
Copy link

coderabbitai bot commented Apr 2, 2025

Walkthrough

  1. MyPageController.java 변경:

    • updateMyPageInfo 메서드 내의 imageFilenickname 파라미터에 대해 required = false 옵션을 추가하여, 해당 파라미터들이 필수가 아니도록 수정하였습니다.
  2. MyPageService.java 변경:

    • 닉네임 업데이트 시, 입력된 값이 null이 아닌 경우에만 업데이트를 진행하도록 로직을 변경하였습니다.
    • 프로필 이미지 처리 로직도, imageFile 파라미터가 null이 아니며 비어 있지 않은 경우에만 실행되도록 수정되었습니다.
    • 불필요한 빈 이미지 파일 검증 메서드(validateProfileImageNotEmpty)가 제거되었습니다.
  3. MyPageServiceTest.java 변경:

    • 빈 이미지 파일 입력 시 예외를 발생시키는 테스트 케이스와 관련 헬퍼 메서드(createEmptyImageFile)가 삭제되었습니다.

Suggested reviewers

  • wibaek
  • nayonsoso
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/main/java/com/example/solidconnection/siteuser/service/MyPageService.java (1)

49-66: 전체 업데이트 메서드 리뷰

PATCH 요청의 특성을 잘 반영한 업데이트입니다! 부분 업데이트가 가능해졌습니다.

  1. 전체 메서드 흐름 개선

    • 닉네임과 이미지 각각 독립적으로 업데이트 가능
    • 변경 사항이 없을 때도 안전하게 처리
  2. 코드 효율성 제안

    • 두 매개변수가 모두 null이거나 이미지가 비어있는 경우 siteUserRepository.save() 호출을 건너뛰는 최적화를 고려해 보세요.
    boolean isUpdated = false;
    
    if (nickname != null) {
        // 기존 코드...
        isUpdated = true;
    }
    
    if (imageFile != null && !imageFile.isEmpty()) {
        // 기존 코드...
        isUpdated = true;
    }
    
    if (isUpdated) {
        siteUserRepository.save(siteUser);
    }

이 개선 사항은 필수는 아니지만, 불필요한 데이터베이스 작업을 줄일 수 있습니다.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1bce344 and 9048db8.

📒 Files selected for processing (3)
  • src/main/java/com/example/solidconnection/siteuser/controller/MyPageController.java (1 hunks)
  • src/main/java/com/example/solidconnection/siteuser/service/MyPageService.java (1 hunks)
  • src/test/java/com/example/solidconnection/siteuser/service/MyPageServiceTest.java (0 hunks)
💤 Files with no reviewable changes (1)
  • src/test/java/com/example/solidconnection/siteuser/service/MyPageServiceTest.java
🔇 Additional comments (3)
src/main/java/com/example/solidconnection/siteuser/controller/MyPageController.java (1)

34-35: 선택적 매개변수 업데이트로 API 유연성 개선!

변경사항을 통해 프로필 수정 API가 더 유연해졌네요! 이제 사용자는 닉네임이나 이미지 중 하나만 선택적으로 수정할 수 있게 되었습니다.

  1. 이미지 파일 매개변수 required = false 추가

    • 이미지 변경 없이 닉네임만 변경 가능
  2. 닉네임 매개변수 required = false 추가

    • 닉네임 변경 없이 이미지만 변경 가능

PATCH 메서드의 의미에 맞게 부분 업데이트를 지원하도록 개선한 좋은 변경입니다! 👍

src/main/java/com/example/solidconnection/siteuser/service/MyPageService.java (2)

50-55: 닉네임 조건부 업데이트 로직 추가!

이제 닉네임이 제공된 경우에만 업데이트하도록 변경되었네요! 명확한 조건 분기로 코드가 더 견고해졌습니다.

  1. null 체크 조건 추가
    • 닉네임이 제공된 경우에만 유효성 검사 및 업데이트 실행
    • 불필요한 검증 로직 스킵으로 성능 향상

한 가지 제안: 닉네임이 현재 값과 동일한 경우에도 불필요한 업데이트를 피하는 추가 체크를 고려해보세요.


57-64: 이미지 처리 로직 개선!

이미지 파일 처리 로직이 더 견고해졌습니다! 조건부 처리와 기본 이미지 보존 로직이 잘 구현되었네요.

  1. null 및 빈 파일 체크 추가

    • 이미지가 제공된 경우에만 업로드 로직 실행
  2. 기본 이미지 보존 로직 추가

    • 기본 이미지가 아닌 경우에만 기존 프로필 이미지 삭제
    • 불필요한 S3 삭제 작업 방지로 리소스 절약

유연하고 효율적인 이미지 처리 방식으로 개선되었습니다! 👏

Copy link
Member

@wibaek wibaek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@Gyuhyeok99 Gyuhyeok99 merged commit a2495ea into solid-connection:develop Apr 3, 2025
1 check passed
@Gyuhyeok99 Gyuhyeok99 deleted the fix/226-user-profile-patch-retry branch May 11, 2025 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

버그 Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

내 정보 변경 로직 수정

2 participants